package com.dk.hi.core;

import java.util.ResourceBundle;

/**
 * Text loader according to the current language
 */
public abstract class I18n {
	/**
	 * The bundle containing all texts
	 */
	private static final ResourceBundle bundle;
	static {
		bundle = ResourceBundle.getBundle("com.dk.hi.resources");
	}

	/**
	 * Returns the text linked to the key in the current language.
	 * 
	 * @param key
	 *            the text key
	 * @return the text or the key if an error occurs
	 */
	public static String get(String key) {
		try {
			return bundle.getString(key);
		} catch (Exception e) {
			e.printStackTrace();
			return key;
		}
	}
}
